<template>
  <div class="collect">
    <div class="main">
      <ul class="list">
        <li v-for="item in collectGoodsList" :key="item.id" @click="itemClick(item)">
          <img :src="item.list_pic_url" alt="" />
          <p class="name">{{ item.name }}</p>
          <p class="price">￥{{ item.retail_price }}</p>
        </li>
      </ul>
    </div>
  </div>
</template>
<script>
import { listAction } from "@/api/my/collect/index";
export default {
  data() {
    return {
      collectGoodsList: [],
    };
  },
  methods: {
    itemClick(item) {
      this.$router.push({
        path: "/goodsdetail",
        query: {
          id: item.id,
        },
      });
    },
  },
  created() {
    listAction({
      openId: localStorage.getItem("openId"),
    }).then((res) => {
      console.log(res);
      this.collectGoodsList = res.data.collectGoodsList;
    });
  },
};
</script>
<style lang="scss" scoped>
@import "./index.scss";
</style>
